package Object;

public class extend {
    public static void main(String[] args) {
        Dog a = new Dog("李兆恒");
        a.bark();
    }
}

class Animal{
    String name;
    public Animal(String name){
        this.name = name;
    }
    public void eat(){
        System.out.println(name+"正在吃东西");
    }
    public void sleep(){
        System.out.println(name+"正在睡觉");
    }
}
class Dog extends Animal{
    public Dog(String name) {
        super(name);
    }
    public void bark(){
        System.out.println(name+"正在狗叫");
    }
    @Override
    public void eat(){
        System.out.println(name+"正在啃骨头");
    }
}
